﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WpfElevator.GlobalConstant;

namespace WpfElevator.ControlPart
{
    class Task
    {
        public int[] floors = new int[GConstant.MAXTASKNUMBER];
        public int[] states = new int[GConstant.MAXTASKNUMBER];//1up/0down/2内部无上下
        public int tasknum = 0;
        public Task()
        {
            for (int i = 0; i < GConstant.MAXELEVATORNUMBER; i++)
            {
                this.floors[i] = -1;
                this.states[i] = -1;
            }
        }
        public int MaxFloors()
        {
            if (this.tasknum == 0)
                return 0;

            int t = this.floors[0];
            for (int i = 0; i < tasknum; i++)
                if (this.floors[i] > t)
                    t = this.floors[i];
            return t;
        }
        public int MinFloors()
        {
            if (this.tasknum == 0)
                return 0;

            int t = this.floors[0];
            for (int i = 0; i < tasknum; i++)
                if (this.floors[i] < t)
                    t = this.floors[i];
            return t;
        }
    }
}
